<template>
  <el-dialog :title="form.modelName" v-model="open" width="800px" @open="initOpen" append-to-body :before-close="close"
    @close="close">
    <!-- <p class="dialogTitle">{{form.modelName}}</p> -->
    <el-form ref="casualtiesRef" :model="form" label-width="120px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="模型名称" prop="modelName">
            {{form.modelName}}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否默认" prop="">
            {{form.isDefault=='0'?'否':'是'}}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="地区" prop="">
            {{form.province}} - {{form.city}}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="维护人" prop="">
            {{form.createUserName}}
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="维护人单位" prop="">
            {{form.orgName}}
          </el-form-item>
        </el-col>
      </el-row>
      <el-divider border-style="dashed"></el-divider>
      <el-row>
        <el-col :span="6" class="tab-title">
          建筑物破坏评估模型
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12" :offset="6">
          <span style="font-size: 16px;font-weight: bold;font-style: italic;">F(I) = ∑<sub>n</sub> ∑<sub>s</sub>
            ∑<sub>j</sub> P [<span style="position: absolute;top: -15px;">D<sub>j</sub></span>—<span
              style="position: absolute;top: 12px;margin-left: -10px;">I</span>] * B<sub>s</sub> </span><br /><br />
          式中：<br />
          I --表示地震烈度；<br />
          N --表示烈度圈I内的单元数据（公里格网）；<br />
          F(I)--表示在烈度I内，各类建筑的每类破坏面积之和；<br />
          P[D<sub>j</sub>/I]--表示s类建筑在烈度I，j类破坏比率；<br />
          B<sub>s</sub> --表示I烈度，每个单元中s类建筑的面积。<br />
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6" class="tab-title">
          根据损坏比计算死亡比
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12" :offset="6">
          <span style="font-size: 16px;font-weight: bold;font-style: italic;">log RD = {{form.smrsNumber1}} A<sup>0.1</sup>-{{form.smrsNumber2}}
          </span><br /><br /><br />
          RD为死亡比，A为房屋毁坏比（房屋毁坏面积/房屋总面积）<br />
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6" class="tab-title">
          计算死亡人数
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12" :offset="6">
          <span style="font-size: 16px;font-weight: bold;font-style: italic;">D = ∑<sub
              style="position: absolute;top: 20px;margin-left: -6px;">i</sub>（RD<sub>i</sub> * {{form.deathNumber}} *
            P<sub>t</sub>）</span><br /><br />
          D为评估区死亡人数，RD<sub>i</sub>为公里格网在i烈度下的死亡率，
          {{form.deathNumber}} 为人口变化特征修正值（系数）（区间范围（0,10]），
          计算死亡人数时，考虑灾区人口时空变化特征作为修正，
          主要考虑外出务工比例及外出和回家规律、景点旺季游客规模和淡季游客规模等关键因素。
          P<sub>t</sub>为每个公里格网的总人数。<br />

        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6" class="tab-title">
          计算受伤人数
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12" :offset="6">
          <span style="font-size: 16px;font-weight: bold;font-style: italic;">F = D * {{form.injuries}} </span><br /><br />
          F为受伤人数，{{form.injuries}}为受伤人数与死亡人数的比例，一般为3到5倍。<br />
        </el-col>
      </el-row>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button type="primary" @click="close">关闭</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup>
import { getCasualtyModelById } from '@/api/earthquakeLossesEstimation/earthquakeSetting'

const props = defineProps({
  open: Boolean,
  id: {
    type: String,
    default: ''
  }
})
const emits = defineEmits(['update:open'])
const data = reactive({
  form: {
    modelName: '',
    isDefault: '',
    province: '',
    city: '',
    createUserName: '',
    orgName: ''
  }
})
const { form } = toRefs(data)
// 查询模型详情
const getModelDetail = () => {
  getCasualtyModelById(props.id).then(res => {
    if (res.code == 200) {
      res.data && (form.value = res.data)
    }
  })
}

const initOpen = () => {
  getModelDetail()
}
const close = () => {
  emits('update:open', false)
}
</script>
<style scoped lang="scss">
.el-form {
  padding-top: 20px;
  .el-form-item {
    margin-bottom: 0;
  }
}

.tab-title {
  font-size: 16px;
  font-weight: bold;
  border-left: 4px solid var(--el-color-primary);
  font-family: PingFangSC-Medium;
  padding-left: 10px;
  margin-bottom: 20px;
}
</style>